using Ocelot.DependencyInjection;
using Ocelot.Middleware;

namespace hao_Gateway
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var builder = WebApplication.CreateBuilder(args);

            // 添加日志
            builder.Logging.AddConsole();
            builder.Logging.SetMinimumLevel(LogLevel.Debug);

            // 添加Ocelot配置文件
            builder.Configuration.AddJsonFile("ocelot.json", optional: false, reloadOnChange: true);

            // 添加Ocelot服务
            builder.Services.AddOcelot();

            var app = builder.Build();

            Console.WriteLine("Starting Ocelot Gateway...");
            
            // 使用Ocelot中间件
            app.UseOcelot().Wait();
        }
    }
}
